﻿@model UscSunShine.Models.MainPageModel

@{
    ViewBag.Title = "主页";
}


<div class="row">
    <div class="col-md-5">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">
                    <img src="~/image/ball.png" alt="ball" style="zoom:0.8;" /> 阳光服务资讯
                </h3>
            </div>
            <div class="panel-body">
                <div id="myCarousel" class="carousel slide" data-ride="carousel">
                    <!-- 轮播（Carousel）指标 -->
                    <ol class="carousel-indicators">
                        <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
                        <li data-target="#myCarousel" data-slide-to="1"></li>
                        <li data-target="#myCarousel" data-slide-to="2"></li>
                    </ol>
                    <!-- 轮播（Carousel）项目 -->
                    <div class="carousel-inner">
                        <div class="item active">
                            <img src="~/image/slide1.jpg" alt="First slide">
                            <div class="carousel-caption"></div>
                        </div>
                        <div class="item">
                            <img src="~/image/slide2.jpg" alt="Second slide">
                            <div class="carousel-caption"></div>
                        </div>
                        <div class="item">
                            <img src="~/image/slide3.jpg" alt="Third slide">
                            <div class="carousel-caption"></div>
                        </div>
                    </div>
                    <!-- 轮播（Carousel）导航 -->
                    <a class="carousel-control left" href="#myCarousel"
                       data-slide="prev">&lsaquo;</a>
                    <a class="carousel-control right" href="#myCarousel"
                       data-slide="next">&rsaquo;</a>
                </div>
                <div style="text-align:right">
                    <a class="btn-link" href="#">更多>></a>
                </div>
            </div>
        </div>
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">
                    <img src="~/image/ball.png" alt="ball" style="zoom:0.8;" /> 阳光服务公告栏
                </h3>
            </div>
            <div id="pubInfo" class="panel-body">
                @* 滚动表格 *@
                <div id="A1" style="height:172px; overflow:hidden; display:block;">
                    <table id="pubTable1" class="table table-striped table-hover table-condensed">
                        <tbody>
                            @foreach (var item in Model.PostList)
                            {
                                <tr>
                                    <td class="longItem" width="79%">
                                        <span style="color:rgb(49,176,213);" class="glyphicon glyphicon-file"></span>
                                        @Html.ActionLink(item.Title, "../Post/Details", new { id = item.ID })
                                    </td>
                                    <td style="text-align:end;">
                                        [@Html.DisplayFor(s => item.InputDate.Month)-
                                        @Html.DisplayFor(s => item.InputDate.Day)]
                                    </td>
                                </tr>
                            }
                        </tbody>
                    </table>
                </div>
                <div style="text-align:right">
                    <a class="btn-link" href="/Post/Index">更多>></a>
                </div>
            </div>
        </div>
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">
                    <img src="~/image/ball.png" alt="ball" style="zoom:0.8;" /> 阳光服务信息统计
                </h3>
            </div>
            <div id="infoStatistic" class="panel-body">
                <div class="col-md-7">
                    <span style="color: blue;" class="glyphicon glyphicon-envelope"></span>&nbsp; 领导信箱
                    <br />
                    <br />
                    <address>
                        <strong>地址：</strong>
                        <a href="mailto:nhxzb@usc.edu.cn">nhxzb@usc.edu.cn</a>
                        @*<br />
                        <strong>校长信箱</strong>
                        <a href="mailto:nhxzb@usc.edu.cn">nhxzb@usc.edu.cn</a>*@
                    </address>
                </div>
                <div class="col-md-5">
                    <span style="color: blue;" class="glyphicon glyphicon-stats"></span>
                    &nbsp;最新统计
                    <address>
                        <strong>累计收件：@Html.DisplayFor(model => model.StatisticModel.CountOfRequest)</strong>
                        <br />
                        <strong>未处理收件：@Html.DisplayFor(model => model.StatisticModel.CountOfProcessing)</strong>
                        <br />
                        <strong>已处理收件：@Html.DisplayFor(model => model.StatisticModel.CountOfProcessed)</strong>
                    </address>
                </div>
            </div>
        </div>
    </div>

    <div class="col-md-6">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">
                    <img src="~/image/ball.png" alt="ball" style="zoom:0.8;" /> 阳光服务信息台
                </h3>
            </div>
            <div class="panel-body">
                <table id="mainTable" class="table mainTable">
                    <thead>
                        <tr>
                            @*<th>流水号</th>*@
                            <th style="width:10%">状态</th>
                            <th width="35%">主题</th>
                            <th width="20%">日期</th>
                            <th width="10%">类别</th>
                            <th style="width:18%;">受理单位</th>
                        </tr>
                    </thead>
                </table>
                <div id="A2" style="height:502px; overflow:hidden; display:block;">
                    <table id="pubTable2" class="table table-striped table-hover table-condensed">
                        <tbody>
                            @foreach (var item in Model.RequestList)
                            {
                                <tr>
                                    @*<td>
                                            @Html.DisplayFor(s => item.ID)
                                        </td>*@
                                    <td style="width:10%;color:red;">
                                        @switch(item.ProcessStatus){
                                        case UscSunShine.Models.ProcessStatus.按时办结:
                                        <span style="color:green;" class="glyphicon glyphicon-star"></span>
                                        break;
                                        case UscSunShine.Models.ProcessStatus.正在办理:
                                        case UscSunShine.Models.ProcessStatus.已受理:
                                        <span style="color:blue;" class="glyphicon glyphicon-star"></span> 
                                        break;
                                        case UscSunShine.Models.ProcessStatus.超期办结:
                                        <span style="color:orange;" class="glyphicon glyphicon-star"></span>
                                        break;
                                        case UscSunShine.Models.ProcessStatus.超期未办结:
                                        <span style="color:red;" class="glyphicon glyphicon-star"></span>
                                        break;
                                        }
                                    </td>
                                    <td class="longItem" width="35%">
                                        @Html.ActionLink(item.Title, "../Request/Details", new { id = item.ID })
                                    </td>
                                    <td width="20%">
                                        @Html.DisplayFor(s => item.AcceptDate.Year)-
                                        @Html.DisplayFor(s => item.AcceptDate.Month)-
                                        @Html.DisplayFor(s => item.AcceptDate.Day)
                                    </td>
                                    <td width="10%">
                                        @Html.DisplayFor(s => item.RequestCategory)
                                    </td>
                                    <td style="width:18%;" class="longItem">
                                        @Html.DisplayFor(s => item.Department.Name)
                                    </td>
                                </tr>
                            }
                        </tbody>
                    </table>
                </div>
            </div>
            <div style="text-align:left;margin-left:20px;">
                <span style="color:green;" class="glyphicon glyphicon-star">按时办结&nbsp;</span>
                <span style="color:blue;" class="glyphicon glyphicon-star">正在办理&nbsp;</span>
                <span style="color:orange;" class="glyphicon glyphicon-star">超期办结&nbsp;</span>
                <span style="color:red;" class="glyphicon glyphicon-star">超期未办结&nbsp;</span>
                <a style="float:right;" class="btn-link" href="/Request/Index">更多>></a>
            </div>
        </div>
    </div>

    <div class="col-md-1">
        @Html.ActionLink("我要咨询", "../Request/Create", new { category = UscSunShine.Models.RequestCategory.咨询 }, new { @class = "btn btn-info btn-sm" })
        @Html.ActionLink("我要建议", "../Request/Create", new { category = UscSunShine.Models.RequestCategory.建议 }, new { @class = "btn btn-info btn-sm" })
        @Html.ActionLink("我要投诉", "../Request/Create", new { category = UscSunShine.Models.RequestCategory.投诉 }, new { @class = "btn btn-info btn-sm" })
        @Html.ActionLink("我要表扬", "../Request/Create", new { category = UscSunShine.Models.RequestCategory.表扬 }, new { @class = "btn btn-info btn-sm" })
    </div>
</div>
<div id="last-of-page1">
    <center>
        <ul class="nav navbar-nav">
            <li>
                <a style="font-weight:bold;color:black;">办事机构：</a>
            </li>
            @for (int i = 0; i < 7 && i < Model.DepartmentList.Count; i++)
            {
                <li>
                    <a target="_self" href="~/Home/WorkFlow?currentDepartmentID=@Model.DepartmentList[i].ID">@Model.DepartmentList[i].Name</a>
                </li>
            }
            <li>
                <a target="_blank" href="~/Home/WorkFlow">更多>></a>
            </li>
        </ul>
    </center>
</div>

<script src="@Url.Content("~/Scripts/myScript.js")" type="text/javascript"></script>

@if (Model.RequestList.Count > 14)
{
    <script>
        if (document.getElementById("A2")) {
            eval(_InitScroll("A2", "pubTable2", 530, 30 * 14, 100));
        }
    </script>
}

@if (Model.PostList.Count > 6)
{
    <script>
        if (document.getElementById("A1")) {
            eval(_InitScroll("A1", "pubTable1", 430, 30 * 5, 100));
        }
    </script>
}